<?php


namespace app\common\model;


use think\Model;

class ContentCategory extends Model
{
    protected $autoWriteTimestamp = true;
    public function insertDate($data){
        $data = [
            'category_name'=>$data
        ];
        $result = $this->save($data);
        return $result;
    }
    public function getList(){
        $result = $this->select();
        return $result;
    }
    public function getDetail($id){
        $where = [
            "id"=>$id
        ];
        $result = $this->where($where)->find();
        return $result;
    }

    public function updateCategory($data){
        $where = [
            "id"=>$data['id'],
        ];

        $updateDate = [
            "category_name" => $data['category_name']
        ];

        $result = $this->where($where)->save($updateDate);
        return $result;
    }

    public function remove($id){
        $where = [
            'id'=>$id
        ];
        $result = $this->where($where)->delete();
        return $result;
    }

}